package com.judian.smart.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.judian.smart.activity.AlarmClockActivity;

import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;

//闹钟广播接收器
public class AlarmReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if ("android.alarm.alarmclock.MainService".equals(intent.getAction())) {
            String content = intent.getStringExtra("content");
            long time = intent.getLongExtra("time",0);
            intent.putExtra("content", content);
            intent.putExtra("time", time);
            intent.setClass(context, AlarmClockActivity.class);
            intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        }
    }
}
